<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计算器</title>
	</head>
	<body>
		<div id="app">
			<!-- 输入完毕后,回车键触发 -->
			数据A:<input type="text" v-model="num1"/>
			数据B:<input type="text" v-model="num2" @keydown.enter="addSum()"/>
			总数:<span>{{sum}}</span>
			
		</div>
		<script src="../js/vue.js"></script>		
		<script>
			const app=new Vue({
				el: "#app",
				data:{
					num1:0,
					num2:0,
					sum:0
				},
				methods:{
					addSum(){
						this.sum=parseInt(this.num1)+parseInt(this.num2) 
					}
					
				}
			})
		</script>
		
		
	</body>
</html>
